home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 21.zip
/
BS1 part 21
/
Professional Page v4.0 (1993)(Gold Disk)(Disk 1 of 4)[HD].7z
/
Professional Page v4.0 (1993)(Gold Disk)(Disk 1 of 4)[HD].adf
/
rexx.lzh
/
DropCaps.pprx
< prev
next >
Wrap
Text File
|
1992-03-13
|
4KB
|
156 lines
/*
@BDropCaps @P@ICopyright Gold Disk Inc., February, 1992
This Genie creates a drop cap by extracting a number of characters from the first paragraph of a box and placing them in a new box.
*/
if ~show(l, "gdarexxsupport.library") then
if ~addlib("gdarexxsupport.library", 0, -30) then
exit_msg("Please install the gdarexxsupport.library in your libs: directory before running this Genie.")
cr = '0a'x
call SafeEndEdit.rexx()
units = ppm_GetUnits()
call ppm_SetUnits(1)
address command
signal on halt
signal on break_c
signal on break_e
signal on break_d
box = ppm_ClickOnbox("Click on box in which to add drop cap..")
if box = 0 then exit_msg()
if upper(word(ppm_GetBoxInfo(box), 1)) ~= 'TEXT' then
exit_msg("The box must contain text..")
form = ppm_GetForm("Enter drop cap info", 8, "# letters:1"cr"# lines:3")
if form = '' then exit_msg()
call ppm_AutoUpdate(0)
parse var form letters '0a'x lines
if datatype(letters) ~= 'NUM' | datatype(lines) ~= 'NUM' then
exit_msg("Invalid input")
text = ppm_GetArticleText(box, 1)
if text = '' then exit_msg("No text in box")
droptext = ''
letter = 0
cpos = 1
do while letter < letters
cpos = skipcodes(text, cpos)
if cpos = 0 then leave
char = substr(text, skipcodes(text, cpos), 1)
if char = "\" then iterate
droptext = droptext || char
text = delstr(text, cpos, 1)
letter = letter + 1
end
angle = ppm_GetBoxAngle(box)
marg = ppm_GetBoxMargins(box)
bpos = ppm_GetBoxPosition(box)
call ppm_ShowStatus("Working..")
call SafeSetEdit.rexx(box)
size = ppm_GetSize()
font = ppm_GetFont()
color = ppm_GetTextColor()
lspce = ppm_GetLineSpacing()
call SafeEndEdit.rexx()
type = word(lspce, 1)
if type = 0 then
lspce = size + word(lspce, 2)
else if type = 1 then
lspce = word(lspce, 2)
else
lspce = size * (word(lspce,2)/100)
font = ppm_SelectFromList("Select Drop Cap font", 30, 8, 0, FontList.rexx(font))
if font = '' then exit_msg()
boxheight = (word(marg, 2) + max(1, lines) * lspce + word(marg, 4)) / 72
boxwidth = (word(marg, 1) + .7 * lines * size * letters + word(marg, 3)) / 72
newbox = ppm_CreateBox(-1000, -1000, boxwidth, boxheight, angle)
call ppm_SetBoxTextWrap(newbox,1, 2)
call ppm_SetBoxStandoff(newbox, .1)
call ppm_BoxToFront(newbox)
call SafeSetEdit.rexx(newbox)
call ppm_SetSize(max(1, lines) * lspce)
call ppm_SetFont(font)
call ppm_SetTextColor(color)
call ppm_SetLineSpacing(2, 100)
call SafeEndEdit.rexx()
call ppm_TextIntoBox(newbox, droptext)
call ppm_DeleteContents(box)
call ppm_TextIntoBox(box, text)
call ppm_ShowStatus("Reflowing text..")
if ppm_TextOverFlow(newbox) then
do
call ppm_SetBoxTextWrap(newbox,1, 2)
oldboxheight = boxheight
oldboxwidth = boxwidth
boxheight = 1.2 * boxheight
call ppm_SetBoxSize(newbox, boxwidth, boxheight)
call ppm_ShowStatus("Working..")
/* working on text box */
do while ppm_TextOverFlow(newbox)
boxwidth = 1.1 * boxwidth
call ppm_SetBoxSize(newbox, boxwidth, boxheight)
end
tempbox = ppm_CreateBox(word(bpos, 1), word(bpos, 2), boxwidth, lspce / 72 * (lines - .5) + word(marg, 2) + word(marg, 4), angle)
call ppm_BoxToFront(tempbox)
call ppm_BoxToFront(newbox)
call ppm_SetBoxTextWrap(tempbox,word(1,1), word(1,2))
call ppm_SetBoxTextWrap(newbox,word(0,1), word(0,2))
end
call ppm_SetBoxPosition(newbox, word(bpos, 1), word(bpos, 2))
exit_msg("Done")
halt:
break_c:
break_e:
break_d:
call exit_msg("User Aborted Genie")
exit_msg: procedure expose units
do
parse arg message
call ppm_SetUnits(units)
if message ~= '' then
call ppm_Inform(1, message,)
call ppm_ClearStatus()
call ppm_AutoUpdate(1)
exit
end